Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Display more information in the dataset preview #138

Merged
merged 6 commits into from
Oct 14, 2021

Conversation

bprusinowski
Copy link
Collaborator

@bprusinowski bprusinowski commented Oct 13, 2021

Closes #135.

This PR adds the email & landing page URL to the dataset preview.

  • If there is an contactEmail attached to the cube, then the the email field will contain a mailto: href; the label will be either a contactName (if exists), otherwise it'll be the contactEmail.
  • If there is a landingPage attached to the cube, then the landingPage field will contain a href and a label (both equal to the landingPage).

@jstcki jstcki temporarily deployed to visualize-ad-feat-add-a-iq1x7t October 13, 2021 11:13 Inactive
@jstcki jstcki temporarily deployed to visualize-ad-feat-add-a-iq1x7t October 13, 2021 11:20 Inactive
<DataSetMetadataBody>
{data.dataCubeByIri.contactEmail ? (
<Link href={`mailto:${data.dataCubeByIri.contactEmail}`}>
{data.dataCubeByIri.contactEmail}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the metadata there should also be the actual name associated that we should display here (contactName).

</DataSetMetadataTitle>
<DataSetMetadataBody>
{data.dataCubeByIri.contactEmail ? (
<Link href={`mailto:${data.dataCubeByIri.contactEmail}`}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be next/link (since there's no page routing involved) but the Link component from theme-ui, so the proper styles can be used.

@jstcki
Copy link
Contributor

jstcki commented Oct 13, 2021

@bprusinowski The landing page info should be explicitly part of the metadata. In fact, it's already parsed here:

landingPage: cube.out(ns.dcat.landingPage)?.value,
Beware that it can be optional (contact point potentially as well?), so make sure to display "–" when that's the case, like in the other fields.

@bprusinowski
Copy link
Collaborator Author

@herrstucki, I guess the links shouldn't look like this – should the style from e.g. "Download data" below a published chart be applied there?

Screenshot 2021-10-13 at 14 39 19

@jstcki
Copy link
Contributor

jstcki commented Oct 13, 2021

@bprusinowski Yes, at least the color and underline styles

@jstcki jstcki temporarily deployed to visualize-ad-feat-add-a-iq1x7t October 13, 2021 13:51 Inactive
@bprusinowski bprusinowski requested a review from ptbrowne October 13, 2021 14:04
@bprusinowski bprusinowski marked this pull request as ready for review October 13, 2021 14:04
@bprusinowski bprusinowski requested a review from jstcki October 13, 2021 14:04
Copy link
Contributor

@jstcki jstcki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 👍

wordBreak: "break-word",
"&:hover": {
textDecoration: "underline",
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit unfortunate to have to inline those styles here no ? Shouldn't we use a textStyle or refactor into a common Link component ?

Copy link
Collaborator

@ptbrowne ptbrowne Oct 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that theme-ui supports variants : https://theme-ui.com/components/link/#variants.

I feel like the ease of use of the sx property does not incentivize to have common style, I find it a bit problematic.

This is a nit, not a blocker and I am interested in what you think on this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ptbrowne Yes, but there are other instances where this is done inline and there would be an opportunity to clean this up more generally. As a bonus challenge, we should maybe discuss if it would be worth it to replace theme-ui with Chakra. APIs are very similar but the latter is better maintained and more feature-complete in terms of the components provided.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, I based the implementation on the other examples from the code – but I also agree that it might be worth to have some of the common logic extracted to separate components; not sure if it shouldn't be a separate issue and PR then if we agree on that!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I think it's preferrable not to add debt and to continuously clean things up (Boy scout rule :-)), this is why I prefer to bring those problems during the review.

I think now that the PR is already approved that we can merge, but in the future I think it would be preferable to tackle those smallish issues as part of the PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the chakra ui, I think it would be worth to try it, for a more middle term goal. This is something we can discuss in the dev weekly, I'd be glad to know more about the state of our tech stack, if we have other places where we use theme-ui and where we'd want to use chakra.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, there's already a buttons.inline variant in the theme, if you want @bprusinowski you could try to add a links section to the theme, as described here: https://theme-ui.com/components/link

@jstcki jstcki temporarily deployed to visualize-ad-feat-add-a-iq1x7t October 14, 2021 07:50 Inactive
@ptbrowne ptbrowne self-requested a review October 14, 2021 07:54
@ptbrowne
Copy link
Collaborator

Thanks 🎉

@bprusinowski bprusinowski merged commit fd35acd into main Oct 14, 2021
@bprusinowski bprusinowski deleted the feat/add-additional-info-to-chart-metadata branch October 14, 2021 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show more data cube metadata
3 participants